package com.yuanheng100.ems4j.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import com.yuanheng100.ems4j.model.Ems4jLogLogin;

public interface Ems4jLogLoginMapper {

    @Insert({
        "insert into ems4j_log_login (logid, userid, ",
        "ip, browser, os, ",
        "logintime, appid)",
        "values (#{logid,jdbcType=INTEGER}, #{userid,jdbcType=INTEGER}, ",
        "#{ip,jdbcType=INTEGER}, #{browser,jdbcType=SMALLINT}, #{os,jdbcType=SMALLINT}, ",
        "#{logintime,jdbcType=TIMESTAMP}, #{appid,jdbcType=INTEGER})"
    })
    int insert(Ems4jLogLogin record);



    @Select({
        "select",
        "logid, userid, ip, browser, os, logintime, appid",
        "from ems4j_log_login",
        "where logid = #{logid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="logid", property="logid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="userid", property="userid", jdbcType=JdbcType.INTEGER),
        @Result(column="ip", property="ip", jdbcType=JdbcType.INTEGER),
        @Result(column="browser", property="browser", jdbcType=JdbcType.SMALLINT),
        @Result(column="os", property="os", jdbcType=JdbcType.SMALLINT),
        @Result(column="logintime", property="logintime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="appid", property="appid", jdbcType=JdbcType.INTEGER)
    })
    Ems4jLogLogin selectByPrimaryKey(Integer logid);

}